<?php

namespace App\Http\Controllers\Home;

use App\Model\Article;
use App\Repositories\Criteria\Common\Status;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Model\ArticleRepository;

class IndexController extends Controller
{
    /**
     * ArticleRepository
     *
     * @var Acticles
     */
    protected $article;

    /**
     * 一页显示行数
     *
     * @var int
     */
    protected $rowNum = 50;

    /**
     * 发布状态
     *
     * @var int
     */
    protected $status = 1;

    protected $articleService;

    /**
     * IndexController constructor.
     * @param Acticles $article
     */
    public function __construct(ArticleRepository $article)
    {
        $this->article = $article;
    }

    /**
     * 前端显示文章列表
     *
     * @param Request $request
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request){
        $list = $this->article->getFormalList($this->rowNum);
        //修改原因，不用with，用compact
        //return view('home/index/index')->with(['list' => $list]);
        return view('home/index/index',compact('list'));
    }
}